package com.example.rentingapp.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import com.example.rentingapp.fragment.*;

public class MyFragmentPagerAdapter extends FragmentStateAdapter {
    public MyFragmentPagerAdapter(@NonNull FragmentManager fragmentManager, @NonNull Lifecycle lifecycle) {
        super(fragmentManager, lifecycle);
    }

    @NonNull
    @Override
    public Fragment createFragment(int position) {
        switch (position) {
            case 0:
                return new MainFragment();
            case 1:
                return new SearchFragment();
//            case 2:
//                return new MessageFragment();
            case 2:
                return new MineFragment();
        }
        return null;
    }

    @Override
    public int getItemCount() {
        return 3;
    }
}
